package util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

import org.apache.commons.dbcp.BasicDataSource;
import org.springframework.jdbc.core.JdbcTemplate;

import basetest.BaseTest;

public class DbConnect{
	private static final ResultSet Connection = null;
	public static String queryString ="";
	static Connection myConn;
	public String databaseUrl ="";
	public static String username ="mapmaker";
	public static String password ="mapmaker";
	
	
	
	public static ResultSet dbConnectOracleRS(String orderQuery) {
		 
	     
	     try 
	     {
	             Class.forName("org.postgresql.Driver");
	             System.out.println("PostgreSQL JDBC Driver Registered!");
	             myConn = DriverManager.getConnection( "jdbc:postgresql://lv542/mapmaker",
	                             username, password );

	            
	             if (myConn != null)
	                     System.out.println("Successfully connected to Postgres Database");

	             Statement statement = myConn.createStatement();
	             queryString = orderQuery;
	             ResultSet rs = statement.executeQuery(queryString);
	             return rs;
	     }
	 
	catch( Exception ex ) 
	{
	 ex.printStackTrace();
	}
	finally
	{
	     try{myConn.close();
	     }catch(Exception e ){}
	}
		return Connection;
		
	}
}


